<?php use_helper('Date'); ?>
<h1 class="favorite">
  <?php echo image_tag('icons/favorite') ?>
  Favourite bookmarks
</h1>

<table id="bookmarksList">
  <tbody>
    <?php foreach ($bookmarks as $bookmark): ?>
    <tr class="bookmark">
      <td class="two-lines-date">
        <?php echo format_date($bookmark['created_at'], 'dd') ?>
        <span><?php echo format_date($bookmark['created_at'], 'MMM') ?></span>
      </td>
      <td>
        <?php echo link_to($bookmark['description'], $bookmark['url'], array(
          'onclick' => 'document.location.href="'.url_for('@out?id='.$bookmark['id']).'"; return false'
        )) ?>
      </td>
      <td>
          <?php foreach($bookmark['Tag'] as $tag): ?>
          <span class="tag">
            <?php echo link_to($tag['name'], '@tag?name='.$tag['name']); ?>
            <?php echo link_to('x', 'tag/delete?id='.$tag['id'], array('method' => 'delete')); ?>
          </span>
          <?php endforeach ?>
      </td>
      <td><?php echo link_to(image_tag('icons/delete'), 'bookmark/delete?id='.$bookmark['id'],
              array('method' => 'delete', 'confirm' => 'Are you sure?', 'class' => 'noborder hover-actions')); ?></td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>

<script type="text/javascript">stripe("bookmarksList");</script>
<a href="<?php echo url_for('bookmark/new') ?>">New</a>
